#ifndef CUBE_H
#define CUBE_H
#include "Math/MathDefines.h"
#include <QList>
namespace GCL { namespace MagicCube {
class Cube
{
public:
    Cube(const Vec3& center, Scalar length);
    ~Cube();

    void init(const Vec3& center, Scalar length);
    int getVertexNumber() const {return positions_.size();}
    Vec3 getPosition(int i) const {return positions_[i];}
    void setPosition(int i, const Vec3& v) {positions_[i] = v;}

    //返回旋转中心的x,y或z
    int getCenter(int i) {return center_[i]*10;}


    Vec4 getColor(int i) const {return colors_[i];}
    void setColor(int i, const Vec4& color) {colors_[i] = color;}
    int getFaceNumber() const {return 6;}

    void rotate(const Vec3 &axis, Scalar angle);

    void render();
    void drawLine(int v0, int v1, int v2, int v3);
    void renderDiagonal();

private:
    void renderFace(int v0, int v1, int v2, int v3,
                    const Vec4& color);
private:
    QList<Vec3> positions_;
    QList<Vec4> colors_; /// color Per face
    // 新加入的正方体中心
    Vec3 center_;
};
}}
#endif // CUBE_H
